#ifndef CHARACTERHAERFILE_H_INCLUDE
#define CHARACTERHAERFILE_H_INCLUDE

#include <string>
#include <sstream>

#ifdef _UNICODE_CHARACTER
typedef wchar_t TCHAR;	// Use Unicode Character Set
typedef std::wstring tstring;
typedef std::wstringstream	tstringstream;
#else
typedef char	TCHAR;	// Use Multi-Byte Character Set (ANSI)
typedef std::string tstring;
typedef std::stringstream	tstringstream;
#endif

/** LPCTSTR can be classified as:
 * LP - Pointer
 * C - Constant
 * T - TCHAR
 * STR - String
*/
typedef const TCHAR* LPCTSTR;
typedef tstring String_t;
typedef tstringstream StringStream_t;
/** To support multiple character-set using single code base, and possibly supporting multi-language, use specific functions(macros).
 *	WC is for Wide Character. Therefore, wcs turns to be wide-character-string.
 *	_tcs would mean _T Character String.
*/
#ifdef _UNICODE_CHARACTER
#define _T(c) 	L##c    // For instance Unicode Character.
#define	TEXT(c) L##c    // For instance Unicode Character.
#define _tcslen	wcslen  // Find the length of Unicode Characters.
#define _tcscmp wcscmp	// Compare the both Unicode Characters.
#define _ttol(str)	wcstol(str, 0, 10)	// Convert the Unicode Character to Interger.
#define _ttod(str) 	wcstod(str, 0)		// Convert the Unicode Character to Double.
#else
#define _T(c)	c		// For instance Multi-Byte Character.
#define TEXT(c)	c		// For instance Multi-Byte Character.
#define	_tcslen	strlen  // Find the length of Multi-Byte Characters.
#define _tcscmp strcmp	// Compare the both Multi-Byte Characters.
#define _ttol(str)	strtol(str, 0, 10)	// Convert the Multi-Byte Character to interger.
#define _ttod(str) 	strtod(str, 0)		// Convert the Multi-Byte Character to Double.
#endif

/** For exsample:
 *	"ANSI String"; 		// ANSI
 * L"Unicode String"; 	// Unicode
 * _T("Either string, depending on compilation"); // ANSI or Unicode
*/

/*
* referecne by http://www.codeproject.com/Articles/76252/What-are-TCHAR-WCHAR-LPSTR-LPWSTR-LPCTSTR-etc
*/
void replace(String_t& subject, LPCTSTR search, LPCTSTR newText, size_t pos = 0);
void replaceTextXML(String_t& context, size_t pos = 0);

#endif